<@master template="master/master-loan" title="新增贷款">
<@css href="/easyui/themes/default/easyui.css"/>
<@css href="/easyui/themes/icon.css"/>
<@js src="/easyui/jquery.easyui.min.js"/><@jsRender/>


<div class="detailsBox">
	<#if (loanApplyFileEntity.billCode)??>
	<form class="action-ajax-form" action="/rcloan/saveContinueloanapply"
		method="post">
		<#else>
		<form class="action-ajax-form" action="/o2oloanapply/saveloanapply"
			method="post">
			</#if>
			<div class="action-ajax-load"
				data-url="<@url value='/rloanstart/view?customerId=${customerId}' />" >
				<p class="onload"></p>
			</div>
			<div class="openBox">
				<h3 class="mt20">
					<i class="jtIco"></i>贷款基本资料
				</h3>
				<div class="detaiTab">
					<table cellspacing="0" cellpadding="0" border="0" width="100%">
						<tbody>
							<#if loanApplyFileEntity.continueLoanParenNo!="">
							<tr>
								<td width="15%" align="right" class="bg">上一笔贷款单号：</td>
								<td width="35%">${loanApplyFileEntity.continueLoanParenNo}</td>
								<#if loanApplyFileEntity.loanType=="BK">
								<td width="15%" align="right" class="bg">是否为续贷：</td>
								<td>是</td> </#if>
							</tr>
							</#if>
							<tr>
								<td width="15%" align="right" class="bg">贷款类型：</td>
								<td width="35%"><@select dataSouceType="OTO_LOAN_TYPE_SB"
									value="${loanApplyFileEntity.loanType}" renderonly="true"/> <input
									type="hidden" name="loanType" id="loanType"
									value="${loanApplyFileEntity.loanType}" />
								</td>
								<td width="15%" align="right" class="bg">信贷经理：</td>
								<td><@autocomplete url="/loanrest/likeOperator?name="
									name="operatorName"
									onclick="_onchange_hidden_input('operatorNo');"
									value="${loanApplyFileEntity.operatorName}"
									hideIdName="operatorNo"
									hideIdValue="${loanApplyFileEntity.operatorNo}"/>(联想)<span
									style="color: red;">*</span><span id="operatorNoErorr"
									style="color: red;"></span>
								</td>
							</tr>
							<tr>
								<td width="15%" align="right" class="bg">申请金额(元)：</td>
								<td><input type="text" name="loanaMount" id="loanaMount"
									class="tabInp inputNum action-valid-field"
									value="${loanApplyFileEntity.loanaMount}"> <span
									style="color: red;">*</span><span id="loanaMountErorr"
									style="color: red;"></span></td>
								<td width="15%" align="right" class="bg"  
								title="1、自营模式：贷款由380金服平台自行获客，并由380金服平台对合作银行提供回购担保； 2、共享模式：贷款由各经办机构推荐获客，并由经办机构对合作银行提供回购担保； 3、推荐模式：贷款由各经办机构推荐获客，由380金服平台对合作银行提供回购担保，续贷不计入佣金模式，计入自营模式。">经营模式<span class=" wenhaoIco"></span>:</td>
								<td ><@select dataSouceType="OPERATION_MODEL"
									name="operationModel" onchange="changeSelect(this);"
									id="operationModel" value="${loanApplyFileEntity.operationModel}"
									class="tabInp action-valid-field" />
									<span style="color: red;">*</span> 
									 <span
									id="operationModel_ERROR" style="color: red;"></span>
								</td>
							</tr>
							<tr>
								<td width="15%" align="right" class="bg">申请期限：</td>
								<td><@select dataSouceType="OTOLOANTERM" name="loanTerm"
									onchange="chechkSelect('loanTerm');"
									value="${loanApplyFileEntity.loanTerm}" id="loanTerm"
									class="tabInp action-valid-field"/> 
									 <span style="color: red;">*</span> 
									<span
									id="loanTerm_ERROR" style="color: red;"></span>
								</td>
								<td width="15%" align="right" class="bg">经办平台：</td>
								<td>
									<span id="default_show" style="display: none;">
										<@autocomplete url="/loanrest/search?name=" name="ltdName" hideIdName="ltd" hideIdValue=""/>(联想)
									</span>
									<span id="default_hidden" style="display: none;"> 
										<input name='operationType' type='hidden' id='operationType'>
										<@autocomplete url="/loanrest/search?operationName=" name="ltdName1" hideIdName="ltd1" hideIdValue="" style="width:200px;"/>(联想)
									</span>
									<span style="color: red;">*</span><span id="ltdErorr" style="color: red;"></span>
								</td>
							</tr>
							<tr>
								<td align="right" class="bg">还款方式：</td>
								<td ><@select dataSouceType="OTOREPAYMENTWAY"
									name="repayMentway" onchange="chechkSelect('repayMentway');"
									id="repayMentway" value="${loanApplyFileEntity.repayMentway}"
									class="tabInp action-valid-field" />  <span style="color: red;">*</span> <span
									id="repayMentway_ERROR" style="color: red;"></span>
								</td>
								<td width="15%" align="right" class="bg" title="推荐人仅限内部员工，如无推荐人填写自己名字。" >内部推荐人<span class=" wenhaoIco"></span>：</td>
								<td >
								<!--  /loanrest/referrer 所有EA人员   -->
								 <@autocomplete url="/rbadloan/liquidate?name="
									name="referrerName"
									value="${loanApplyFileEntity.referrerName}"
									hideIdName="referrerNo"
									hideIdValue="${loanApplyFileEntity.referrerNo}"/>(联想)
									 <span style="color: red;">*</span> 
									<span id="referrerNoErorr" style="color: red;"></span>
								</td>
							</tr>
							<tr>
								<td width="15%" align="right" class="bg">担保方式：</td>
								<td <#if loanApplyFileEntity.loanType=="BK">colspan="3"</#if>><@select dataSouceType="OTOGUARANTEEWAY"
									name="guarAnteeWay" onchange="chechkSelect('guarAnteeWay');"
									id="guarAnteeWay" value="${loanApplyFileEntity.guarAnteeWay}"
									class="tabInp action-valid-field" /> <span style="color: red;">*</span> <span
									id="guarAnteeWay_ERROR" style="color: red;"></span>
								</td>
								<#if loanApplyFileEntity.loanType=="BP"||loanApplyFileEntity.loanType=='BP_JX'||loanApplyFileEntity.loanType=='SG'||loanApplyFileEntity.loanType=='YC'||loanApplyFileEntity.loanType=='SC'>
								<td width="15%" align="right" class="bg">渠道名称：</td>
								<td><@autocomplete url="/rpartner/referrer?loanType=${loanApplyFileEntity.loanType}&partnerName="
									name="partnerName"
									value="${partnerName}"
									hideIdName="partnerId"
									hideIdValue="${loanApplyFileEntity.partnerId}"/>(联想)<span style="color: red;">*</span><span
									id="repayMentway_ERROR" style="color: red;"></span>
								</td>
								</#if>
							</tr>
							<tr>
								<!-- -->
								<td align="right" class="bg">外部推荐方\人：</td>
								<td <#if loanApplyFileEntity.loanType=="BP"||loanApplyFileEntity.loanType=='BP_JX'||loanApplyFileEntity.loanType=='SG'||loanApplyFileEntity.loanType=='YC'||loanApplyFileEntity.loanType=='SC'>colspan="3"</#if>>
								<input type="text" name="commiceRecommend" id="commiceRecommend" 
									value="${loanApplyFileEntity.commiceRecommend}">
								<!--
								<@autocomplete url="/rpartner/referrer?loanType=${loanApplyFileEntity.loanType}&partnerName="
									name="commiceRecommend"
									value="${loanApplyFileEntity.commiceRecommend}"
									hideIdName="commiceRecommendId"
									hideIdValue="${loanApplyFileEntity.commiceRecommendId}"/>(联想)
									<span id="repayMentway_ERROR" style="color: red;">*</span>
									-->
								</td>
								 
							<#if loanApplyFileEntity.loanType=="BK">
								<td width="15%" align="right" class="bg">SD客户名称:</td>
								<td>
								<input type="text" class="easyui-combogrid" name="customerSdNo"  id="customerSdNo" style="width:250px;" ></input> 
								 <span style="color: red;">*</span> 至少输入4个字才能联想
								<input type="hidden" name="customerName"  id="customerName" style="width:250px;" ></input> 
								<input type="hidden" name="customerCode"  id="customerCode" style="width:250px;" ></input> 
								
								 (联想)
								 <!-- 
									<a href="<@url value='/customerNewRest/toShopNameAdd'/>" target="_blank" class="action-ajax-btn">新增品牌贷客户门店名称</a>（品牌贷客户需先新增门店名称）
								-->
								</td>
							</#if>
								
							</tr>
							
							<tr>
								<td align="right" class="bg">备注：</td>
								<td colspan="3"><textarea rows="4" name="remark" cols="80"
										style="resize: none;"
										onpropertychange="if(value.length>200) value=value.substr(0,200)">${loanApplyFileEntity.remark}</textarea>
								</td>
							</tr>
						</tbody>
					</table>
				</div>
			</div>
			<div class=" mtb20 tac">
				<input name="customerId" type="hidden" value="${customerId}">
				<input type="submit" class="btn_auto_30 btn_blue" value="保 存">
				<a class="btn_auto_30 btn_blue ml20"
					href="javascript:history.back();">返回</a>&nbsp;
			</div>
		</form>
</div>
<script type="text/javascript">
$(document).ready(function(){

var va=$("#customerSdNo").combogrid('getValue');

$('#customerSdNo').combogrid({
		loadMsg:'数据加载中,请稍后...',
		panelWidth: 500,
		idField: 'cno',
		textField: 'cname',
		url: '/oaoro2odatasub/jsonword',
		method: 'get',
		 rownumbers:true,//序号   
      collapsible:false,//是否可折叠的   
		columns: [[
			{field:'cno',title:'流水号',width:80},
			{field:'ccode',title:'客户sd号',width:120},
			{field:'cname',title:'客户名简称',width:150},
			{field:'cnames',title:'客户全称',width:150}
		]],
		fitColumns: true,
		delay: 1100,
		keyHandler: {
			up: function() {
			},
			down: function() {
			},
			enter: function() {
			},
			query: function(q) {
				if(q||q.length>3){
					$('#customerSdNo').combogrid("grid").datagrid("reload", { 'reloadname': q });
					$('#customerSdNo').combogrid("setValue", q);
				}
			}
		 },
		 onClickRow:function(rowIndex, rowData){
			//alert(rowData.cname);
			//alert(rowData.cnames);
			//var va=$("#search_exhnames").combogrid('getText');
			//var va=$("#search_exhnames").combogrid('getValue');
			$("#customerName").val(rowData.cname);
			$("#customerCode").val(rowData.ccode);
			//alert(va);
		},
		onLoadSuccess:function(){
			
		}
	});
	
});


function changeSelect(str){
	var operation = str.value;
	if (operation == 'ZY') {
		$("#default_show").hide();
		$("#operationType").val("ZY");
		$("input[name='ltd']").val("");
		$("input[name='ltdName']").val("");
		$("#default_hidden").show();
	} else {
		$("#default_show").show();
		$("#operationType").val("");
		$("input[name='ltd1']").val("");
		$("input[name='ltdName1']").val("");
		$("#default_hidden").hide();
	}
}

</script>
</@master>
